package bindings;
import events.Event;
import client.Client;

public class TestBinding{}
/*

abstract public cclass Pricing //esta clase es una colaboracion
{//tiene 2 colaboraciones
	abstract public cclass Customer 
	{
		abstract public void charge(Item it);
		abstract public float balance();
		abstract public String name();
	}
   
	abstract public cclass Item 
	{
		abstract public float price();
	}
}

abstract public cclass PerStockQuoteBinding extends Pricing
{
    public cclass ClientCustomer extends Customer wraps Client
    //aqui declaro los datos que recibo de los componentes que ya estan declarodos
    //y para eso declaro colaboraciones que emvolveran esos datos
	{
		public String name() 
		{ 
			System.out.println("PerStockQuoteBinding");
			//return wrappee.getName();
			return "";
		}
	}
	
	public cclass StockItem extends Item wraps String 
	{
		public float price() 
		{ System.out.println("2 - PerStockQuoteBinding");
			return 2;//aqui es  un valor constante y de inicializacion
		}
	}
	
	after(Client c, String stock)://after - despues
		(cflow(call(void Client.run(String[])) && target(c))) && 
		(call(Float getStockQuote(String)) && args(stock)) 
	{
	    ClientCustomer(c).charge(StockItem(stock));
	}
}


abstract public cclass DiscountPricing extends Pricing 
{
	abstract public cclass Customer 
	{
		private float balance; 
		private int discountstate = 0;
		
		public void charge(Item it)
		{
			if (discountstate++ == 2) 
			{
				discountstate = 0;
				System.out.println(
						"DiscountPricing: 3for2 discount - charged nothing to customer " 
						+ name() 
						+ ", balance is still: " 
						+ balance);
				return;
			}
			float diff = it.price();
			balance -= diff;
			System.out.println(
					"DiscountPricing: charged "
					+ diff 
					+ " to customer "
					+ name() 
					+ ", balance is: " 
					+ balance);
		}
		
		public float balance() 
		{
			return balance;
		}
	}
}*/ 
